/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "t_genre")
//@NamedQueries({@NamedQuery(name = "TGenre.findAll", query = "SELECT t FROM TGenre t"), @NamedQuery(name = "TGenre.findByGenreId", query = "SELECT t FROM TGenre t WHERE t.genreId = :genreId"), @NamedQuery(name = "TGenre.findByConentType", query = "SELECT t FROM TGenre t WHERE t.conentType = :conentType"), @NamedQuery(name = "TGenre.findByGenreName", query = "SELECT t FROM TGenre t WHERE t.genreName = :genreName"), @NamedQuery(name = "TGenre.findByOrdered", query = "SELECT t FROM TGenre t WHERE t.ordered = :ordered")})
public class TGenre implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "genre_id")
    private String genreId;
    @Column(name = "conent_type")
    private String conentType;
    @Column(name = "genre_name")
    private String genreName;
    @Column(name = "ordered")
    private Integer ordered;
//    @ManyToMany(mappedBy = "tGenreSet")	//此为原配置，错误：failed to lazily initialize a collection of role:
//    private Set<SongSongs> songSongsSet;
//    @ManyToMany(fetch = FetchType.EAGER,mappedBy = "tGenreSet")，两个都配置，错误：17:19:19,109 ERROR [JDBCExceptionReporter] Unknown column 'songsongss0_.genre_id' in 'field list'
//    @ManyToMany(fetch = FetchType.EAGER)，配置立即加载，也错误：17:12:51,343 ERROR [JDBCExceptionReporter] Table 'demo.t_genre_song_songs' doesn't exist

    public TGenre() {
    }

    public TGenre(String genreId) {
        this.genreId = genreId;
    }

    public String getGenreId() {
        return genreId;
    }

    public void setGenreId(String genreId) {
        this.genreId = genreId;
    }

    public String getConentType() {
        return conentType;
    }

    public void setConentType(String conentType) {
        this.conentType = conentType;
    }

    public String getGenreName() {
        return genreName;
    }

    public void setGenreName(String genreName) {
        this.genreName = genreName;
    }

    public Integer getOrdered() {
        return ordered;
    }

    public void setOrdered(Integer ordered) {
        this.ordered = ordered;
    }

//    public Set<SongSongs> getSongSongsSet() {
//        return songSongsSet;
//    }
//
//    public void setSongSongsSet(Set<SongSongs> songSongsSet) {
//        this.songSongsSet = songSongsSet;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (genreId != null ? genreId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TGenre)) {
            return false;
        }
        TGenre other = (TGenre) object;
        if ((this.genreId == null && other.genreId != null) || (this.genreId != null && !this.genreId.equals(other.genreId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.TGenre[genreId=" + genreId + "]";
    }

}
